import { LOGIN, LOG_OUT } from '../constants'

const initState = {
  token: '',
}
function login(state = initState, action) {
  if (action.type === LOGIN) {
    return {
      ...state,
      token: action.payload,
    }
  }
  if (action.type === LOG_OUT) {
    return {
      ...state,
      token: '',
    }
  }
  return state
}
export default login
